﻿using System;
//using System.Collections.Generic;
//using System.Text;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Controls;
using System.Windows.Media;
//using System.Windows.Controls;
//using System.Windows.Data;
//using System.Windows.Documents;
//using System.Windows.Input;
//using System.Windows.Media;
//using System.Windows.Media.Imaging;
//using System.Windows.Navigation;
//using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        double top = 0, left = 0;

        public Window1()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(Window1_Loaded);
            t.DragDelta += new DragDeltaEventHandler(t_DragDelta);
            topleft.DragDelta += new DragDeltaEventHandler(t_DragDelta);
            bottomleft.DragDelta += new DragDeltaEventHandler(t_DragDelta);
            bottomright.DragDelta += new DragDeltaEventHandler(t_DragDelta);
        }

        void t_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            e.Handled = false;
        }

        void t_DragDelta(object sender, DragDeltaEventArgs e)
        {
            left += e.HorizontalChange;
            top += e.VerticalChange;
            Application.Current.MainWindow.Top = top;
            Application.Current.MainWindow.Left = left;
        }

        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            top = Application.Current.MainWindow.Top;
            left = Application.Current.MainWindow.Left;
        }

        private void close_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
